#include<bits/stdc++.h>
using namespace std;
int a[100001];
bool cmp(int a,int b)
{
    return a > b;
}
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    int n;
    cin >> n;
    for(int i = 1;i <= n;i++)
    {
        int s;
        cin >> s;
        a[s]++;
    }
    sort(a+1,a+100000,cmp);
    int sum = 0;
    for(int i = 1;i <= 99999;i++)
    {
        sum = sum + abs(a[i]-a[i+1]);
    }
    cout << sum;
    return 0;
}
